import http from '../../utils/http'
import type {ApiResponse, PageResult} from '../../utils/ApiResponse'
import {PageReviews, Reviews} from "./types/reviews.dto.ts";

export const getAllReviews = (data: PageReviews): Promise<PageResult<Object>> => {
    return http.get(`/reviews/info`, {
        params: {
            page: data.page,
            limit: data.limit,
            comment: data.comment,
        }
    })
}

export const getReviewInfoById = (id: number): Promise<ApiResponse<Reviews>> => {
    return http.get(`/reviews/info/${id}`)
}

export const addReview = (data: Reviews): Promise<ApiResponse<Object>> => {
    return http.post('/reviews', data)
}

export const deleteReviewById = (id: number): Promise<ApiResponse<Object>> => {
    return http.delete(`/reviews/${id}`)
}


